package com.duoduo.springcloud.controller;

import com.duoduo.springcloud.entities.CommonResult;
import com.duoduo.springcloud.feign.PaymentFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * OrderFeignController
 *
 * @author qian
 * @version 1.0
 * @date 2020/11/21 18:03
 */
@RestController
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/payment/get/{id}")
    public CommonResult<?> getPaymentById(@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    //OpenFeign默认等待一秒钟，超过后报错
    @GetMapping(value = "/consumer/payment/timeout")
    public String timeout(){
        return paymentFeignService.timeout();
    }
}
